package exp6_2;

import exp6_1.LinkedList;

public class PetShop {
    private LinkedList pets = new LinkedList();

    public void add(Pet pet) {
        this.pets.add(pet);
    }

    public boolean delete(Pet pet) {
        for (int i = 0; i < this.pets.size(); i++) {
            if (pet.equals(this.pets.get(i).getData())) {
                return this.pets.remove(this.pets.get(i).getData());
            }
        }
        return false;
    }

    public Pet get(int index) {
        if (this.pets.get(index) == null) {
            return null;
        }
        return (Pet) this.pets.get(index).getData();
    }

    public int size() {
        return this.pets.size();
    }
}
